//
//  MineActiveTableViewCell.m
//  MJApp
//
//  Created by wangliang on 15/3/30.
//  Copyright (c) 2015年 wangliang. All rights reserved.
//

#import "MineActiveTableViewCell.h"

@interface MineActiveTableViewCell ()
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *statusLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;

@end

@implementation MineActiveTableViewCell

+ (instancetype)initWithTableView:(UITableView *)tableView {
    
    static NSString *cellID = @"MineActiveTableViewCell";
    MineActiveTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        
        cell =  WL_XIB(@"MineActiveTableViewCell");
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    cell.cellHigh = CGRectGetHeight(cell.frame);
    return cell;
    
}

- (void)setInfoDic:(NSDictionary *)infoDic {
    
    _infoDic = infoDic;
    self.nameLabel.text = infoDic[@"title"];
    self.timeLabel.text = [NSString stringWithFormat:@"%@",infoDic[@"start_time"]];
    self.contentLabel.text = infoDic[@"content"];
    self.statusLabel.text = [infoDic[@"status"] integerValue] == 1 ? @"进行中" : @"已结束";
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (IBAction)checkInfo:(id)sender {
    
    if ([self.delegate respondsToSelector:@selector(homeCell:withInfo:)]) {
        
        [self.delegate homeCell:self withInfo:self.infoDic];
    }
}

@end
